#include <stdlib.h>
#define begin() begin
#define end() end
typedef struct queue queue;
struct queue{
       int *val;
       int begin,end,type,limit;
};
void queue_setsize(queue *base,int size){
     (*base).type=size;
}
void queue_alloc(queue *base,int arg){
     (*base).limit=arg;
     (*base).val=(int*)realloc((*base).val,((*base).type+1) * (arg));
}
int queue_push(queue *base){
     if ((*base).begin()>=(*base).end())
        return 0;
     return (*base).val[(*base).begin()++];
}
char queue_empty(queue base){
    if (base.begin<base.end)
       return 0;
    return 1;
}
void queue_insert(queue *base,int arg){
     if ((*base).limit<=1+(*base).end)
        queue_alloc(&(*base),1+(*base).end);
     (*base).val[(*base).end()++]=arg;
}
